<?php require_once('../Connections/embCon.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_embCon, $embCon);
$query_Recordset1 = "SELECT * FROM potenciamedia_potenciaultima_por_edificio";
$Recordset1 = mysql_query($query_Recordset1, $embCon) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Portal EMB</title>
<script type="text/javascript" src="scripts/mootools-core-1.3-full-compat.js"></script> 
<script type="text/javascript" src="scripts/controller.js"></script> 
<link href="../styles/main.css" rel="stylesheet" type="text/css" /><!--[if lte IE 7]>
<style>
.content { margin-right: -1px; } /* this 1px negative margin can be placed on any of the columns in this layout with the same corrective effect. */
ul.nav a { zoom: 1; }  /* the zoom property gives IE the hasLayout trigger it needs to correct extra whiltespace between the links */
</style>
<![endif]-->
</head>
<div class="container">
  <div class="header"><a href="#"><img src="../pictures/balum_g.gif" alt="Insert Logo Here" name="Insert_logo" width="149" height="206" id="Insert_logo" style="font-size: 100%; text-align: center; vertical-align: middle;" /></a> 
    <!-- end .header -->ESQUADRA DE MANUTENÇÃO BASE</div>
  <div class="sidebar1">
  <div class="link_separator"> </div>
    <ul class="nav">
      <li class="link_title">Gestão de Energia</li>
      <li><a href="#">Consumos instântaneos</a></li>
      <li><a href="#">Consumo diário</a></li>
      <li><a href="#">Consumo mensal</a></li>
      <li><a href="#">Link four</a></li>
    </ul>
    <p>&nbsp;</p>
    <!-- end .sidebar1 --></div>
  <div class="content">
  <td align="center" valign="top" width="70%">	
	<div id="meter">
    <style type="text/css">
.cls_gauge {
	clear: none;
	float: left;
}
</style>
 <h1>Potência por Àreas</h1>
 <?php do { ?>
  	<?php $desc=$row_Recordset1['edificios_id'];?>
     <?php $title=$row_Recordset1['descricao'];?>
     <?php $range=round($row_Recordset1['valormedio']*2);?>
    <?php echo "<div class=\"cls_gauge\" id='gauge$desc'></div>";?>
    <?php echo "<script type=\"text/javascript\"> addGauge('gauge$desc',$range,'$title'); </script>"?> 
    <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
    </div>	</td> 
    <h1>
    
    Notas:</h1>
    <ul>
      <li>Os valores apresentados são medidos em KW (KiloWatt)</li>
      <li>A escala de cada indicador é igual ao valor médio desde sempre vezes dois</li>
    </ul>
<p>&nbsp;</p>
  <!-- end .content --></div>
  <div class="footer">
    <p>Sistema de informação criado por Capitão José Barros. LP </p>
    <!-- end .footer --></div>
  <!-- end .container --></div>

</html>
<?php
mysql_free_result($Recordset1);
?>
